package com.hzhq.contract.convert.method;

import com.hzhq.contract.bean.dto.AdminDTO;
import com.hzhq.contract.bean.vo.AdminVO;
import org.bson.types.ObjectId;

/**
 * @author: hzhq1255
 * @mail: hzhq1255@163.com
 * @date: 2021/4/14 21:29
 * @desc:
 */
public class AdminConvertMethod {


    public static AdminDTO adminVoToAdminDto(AdminVO source) {
        if (source == null) {
            return new AdminDTO();
        }
        ObjectId adminId = new ObjectId();
        if (ObjectId.isValid(source.getAdminId())) {
            adminId = new ObjectId(source.getAdminId());
        }
        return AdminDTO.builder().adminId(adminId).adminName(source.getAdminName()).phone(source.getPhone()).registerTime(source.getRegisterTime()).build();
    }
}
